﻿using Microsoft.Expression.Drawing.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WPFDevelopers.Samples.ViewModels;

namespace WPFDevelopers.Samples.PageViews
{
    /// <summary>
    /// MemberManage.xaml 的交互逻辑
    /// </summary>
    public partial class MemberManage : Page
    {

        List<CheckBox> headerChecks = new List<CheckBox>();
        TablePageModelVM tablePageModel;
        public MemberManage()
        {
            InitializeComponent();
            tablePageModel = new TablePageModelVM();
            this.DataContext = tablePageModel;
            this.GridInfo.ItemsSource = tablePageModel.memberManageModels;
        }

        private void CheckBox_Loaded(object sender, RoutedEventArgs e)
        {
            
            //MessageBoxX.Warning("架构之美、数学之美、.net 核心框架、异步编程的艺术、单元测试的艺术，代码，WPF");
            CheckBox cbtemp = (CheckBox)sender;
            cbtemp.IsChecked = false;
            tablePageModel.headerChecks.Add(cbtemp);
        }

        private void CheckBoxAll(object sender, RoutedEventArgs e)
        {
            tablePageModel.headerChecks.ForEach(a =>
            {
                if ((bool)a.IsChecked)
                    a.IsChecked = false;
                else
                    a.IsChecked = true;
            });
        }
    }
}
